package views
{
	import assists.resource.ResourceLoaderData;
	
	import flash.display.Bitmap;
	
	import inerface.INavigationDetail;
	
	import main.ClientConstants;
	import main.ViewSubBase;
	
	import panel.viewSpots.navigation.NavigationDetailPanel;
	
	public class NavigationDetailView extends ViewSubBase
	{
		private var _data:Object;
		private var _panel:INavigationDetail;
		public function NavigationDetailView()
		{
			super();
		}
		
		override public function show():void
		{
			render();
		}
		
	public function showComp(data:Object):void
	{
		_data = data;
		var recList:Array = [];
		if(data.icon != "")
		{
			recList.push(new ResourceLoaderData(this.data.uri.getNavigationDetailPic(data.icon,view.navigation.navigationID)));
		}
		this.resourceLoader.load(recList,new Function,render);
//		render();
	}
		
		override protected function render():void
		{
			_panel = new NavigationDetailPanel();
			view.comment.shopType = ClientConstants.COMMENT_TYPE_SPOT;
			_panel.onOpenCommitView = view.comment.show;
			_panel.init(layout.stage,resourceLoader,lang,this.data.uri);
			_panel.onOpenSound = openSoundView;
			_panel.show(_data,this.resourceLoader.getImage(this.data.uri.getNavigationDetailPic(_data.icon,view.navigation.navigationID)));
			this.addView(_panel);
			view.guide.upAndDownVisible(false,false);
		}
		
		private function openSoundView(soundUrl:String,desc:String = ""):void
		{
			view.media.soundName = desc;
			view.media.soundUrl = data.uri.getNavigationMp3(soundUrl,view.navigationTypeChoose.key);
			view.media.show();
			view.media.onDelayFunc = function ():void
			{
				_panel.onSoundMedia = view.media.soundMedia;
			}
		}
		
		override public function clear():void
		{
			view.guide.upAndDownVisible(true,true);
		}
		
	}
}